<!doctype html>



  


<html class="theme-next muse use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>



<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.0" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="Hexo, NexT" />








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.0" />






<meta name="description" content="主要是学习后端技术，学过Java web、python web等后台技术">
<meta property="og:type" content="website">
<meta property="og:title" content="jeniusLi's blog">
<meta property="og:url" content="http://yoursite.com/index.html">
<meta property="og:site_name" content="jeniusLi's blog">
<meta property="og:description" content="主要是学习后端技术，学过Java web、python web等后台技术">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="jeniusLi's blog">
<meta name="twitter:description" content="主要是学习后端技术，学过Java web、python web等后台技术">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Muse',
    sidebar: {"position":"left","display":"post","offset":12,"offset_float":0,"b2t":false,"scrollpercent":false},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://yoursite.com/"/>





  <title> jeniusLi's blog </title>
</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  














  
  
    
  

  <div class="container one-collumn sidebar-position-left 
   page-home 
 ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">jeniusLi's blog</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle">生活、技术个人博客</p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            
  <section id="posts" class="posts-expand">
    
      

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
    <link itemprop="mainEntityOfPage" href="http://yoursite.com/2017/03/24/C语言链表/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Jenius">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/jenius.jpeg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="jeniusLi's blog">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                
                <a class="post-title-link" href="/2017/03/24/C语言链表/" itemprop="url">
                  C语言链表
                </a>
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2017-03-24T18:06:43+08:00">
                2017-03-24
              </time>
            

            

            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    


    <div class="post-body" itemprop="articleBody">

      
      

      
        
          
            <h2 id="链表"><a href="#链表" class="headerlink" title="链表"></a>链表</h2><h2 id="代码-linked-list-c"><a href="#代码-linked-list-c" class="headerlink" title="代码 linked-list.c"></a>代码 linked-list.c</h2><figure class="highlight c"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div><div class="line">39</div><div class="line">40</div><div class="line">41</div><div class="line">42</div><div class="line">43</div><div class="line">44</div><div class="line">45</div><div class="line">46</div><div class="line">47</div><div class="line">48</div><div class="line">49</div><div class="line">50</div><div class="line">51</div><div class="line">52</div><div class="line">53</div><div class="line">54</div><div class="line">55</div><div class="line">56</div><div class="line">57</div><div class="line">58</div><div class="line">59</div><div class="line">60</div><div class="line">61</div><div class="line">62</div><div class="line">63</div><div class="line">64</div><div class="line">65</div><div class="line">66</div><div class="line">67</div><div class="line">68</div><div class="line">69</div><div class="line">70</div></pre></td><td class="code"><pre><div class="line"><span class="meta">#<span class="meta-keyword">include</span> <span class="meta-string">"node.h"</span></span></div><div class="line"><span class="meta">#<span class="meta-keyword">include</span> <span class="meta-string">&lt;stdio.h&gt;</span></span></div><div class="line"><span class="meta">#<span class="meta-keyword">include</span> <span class="meta-string">&lt;stdlib.h&gt;</span></span></div><div class="line"></div><div class="line"><span class="comment">// typedef struct _node&#123;</span></div><div class="line"><span class="comment">// 	int value;</span></div><div class="line"><span class="comment">// 	struct _node *next;</span></div><div class="line"><span class="comment">// &#125;Node;</span></div><div class="line"></div><div class="line"><span class="keyword">typedef</span> <span class="keyword">struct</span> _list&#123; <span class="comment">// 没有做尾指针</span></div><div class="line">	Node *head;</div><div class="line">	Node *tail;</div><div class="line">&#125; List;</div><div class="line"></div><div class="line"></div><div class="line"><span class="function"><span class="keyword">void</span> <span class="title">add</span><span class="params">(List *<span class="built_in">list</span>, <span class="keyword">int</span> number)</span></span>;</div><div class="line"><span class="function"><span class="keyword">void</span> <span class="title">add2</span><span class="params">(List *<span class="built_in">list</span>, <span class="keyword">int</span> number)</span></span>;</div><div class="line"></div><div class="line"><span class="function"><span class="keyword">int</span> <span class="title">main</span><span class="params">(<span class="keyword">int</span> argc, <span class="keyword">char</span> <span class="keyword">const</span> *argv[])</span></span></div><div class="line">&#123;</div><div class="line">	List <span class="built_in">list</span>;</div><div class="line">	<span class="built_in">list</span>.head = <span class="built_in">list</span>.tail = <span class="literal">NULL</span>;</div><div class="line">	<span class="keyword">int</span> number;</div><div class="line">	<span class="keyword">do</span>&#123;</div><div class="line">		<span class="built_in">scanf</span>(<span class="string">"%d"</span>,&amp;number);</div><div class="line">		<span class="keyword">if</span>(number != <span class="number">-1</span>)&#123;</div><div class="line">			add2(&amp;<span class="built_in">list</span>,number);</div><div class="line">		&#125;</div><div class="line">	&#125;<span class="keyword">while</span>(number != <span class="number">-1</span>);</div><div class="line">	<span class="keyword">for</span> (Node *q = <span class="built_in">list</span>.head;q;q=q-&gt;next)&#123;</div><div class="line">		<span class="built_in">printf</span>(<span class="string">"%d"</span>,q-&gt;value);</div><div class="line">	&#125;</div><div class="line">	<span class="keyword">return</span> <span class="number">0</span>;</div><div class="line">&#125;</div><div class="line"></div><div class="line"><span class="function"><span class="keyword">void</span> <span class="title">add</span><span class="params">(List *<span class="built_in">list</span>, <span class="keyword">int</span> number)</span></span>&#123;</div><div class="line">	<span class="comment">// add to linked-list</span></div><div class="line">	Node *p = (Node*)<span class="built_in">malloc</span>(<span class="keyword">sizeof</span>(Node));</div><div class="line">	p-&gt;value = number;</div><div class="line">	p-&gt;next = <span class="literal">NULL</span>;</div><div class="line">	<span class="comment">// find last node</span></div><div class="line">	Node *last = <span class="built_in">list</span>-&gt;head;</div><div class="line">	<span class="keyword">if</span>(last)&#123;</div><div class="line">		<span class="keyword">while</span>(last-&gt;next)&#123;</div><div class="line">			last = last-&gt;next;</div><div class="line">		&#125;</div><div class="line">		last-&gt;next = p;</div><div class="line">	&#125;<span class="keyword">else</span>&#123;</div><div class="line">		<span class="built_in">list</span>-&gt;head = p;</div><div class="line">	&#125;</div><div class="line"></div><div class="line"></div><div class="line">&#125;</div><div class="line"></div><div class="line"><span class="function"><span class="keyword">void</span> <span class="title">add2</span><span class="params">(List *<span class="built_in">list</span>, <span class="keyword">int</span> number)</span></span>&#123;  <span class="comment">// 哎，早画图早解决了服了</span></div><div class="line">	<span class="comment">// add to linked-list</span></div><div class="line">	Node *p = (Node*)<span class="built_in">malloc</span>(<span class="keyword">sizeof</span>(Node));</div><div class="line">	p-&gt;value = number;</div><div class="line">	p-&gt;next = <span class="literal">NULL</span>;</div><div class="line">	<span class="comment">// find last node</span></div><div class="line">	<span class="keyword">if</span>(<span class="built_in">list</span>-&gt;tail)&#123;</div><div class="line">		(<span class="built_in">list</span>-&gt;tail)-&gt;next = p;</div><div class="line">		<span class="built_in">list</span>-&gt;tail = (<span class="built_in">list</span>-&gt;tail)-&gt;next;</div><div class="line"></div><div class="line">	&#125;<span class="keyword">else</span>&#123;</div><div class="line">		<span class="built_in">list</span>-&gt;head = <span class="built_in">list</span>-&gt;tail = p;</div><div class="line"></div><div class="line">	&#125;</div><div class="line"></div><div class="line">&#125;</div></pre></td></tr></table></figure>
<p>这是实现了基本的创建链表功能，有两个版本第一个版本(函数add())与第二个版本(add2())相比，第二个版本是具有为指针的每一次不用从头遍历到尾节点。</p>
<p>##删除加寻找<br><figure class="highlight c"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div><div class="line">39</div><div class="line">40</div><div class="line">41</div><div class="line">42</div><div class="line">43</div><div class="line">44</div><div class="line">45</div><div class="line">46</div><div class="line">47</div><div class="line">48</div><div class="line">49</div><div class="line">50</div><div class="line">51</div><div class="line">52</div><div class="line">53</div><div class="line">54</div><div class="line">55</div><div class="line">56</div><div class="line">57</div><div class="line">58</div><div class="line">59</div><div class="line">60</div><div class="line">61</div><div class="line">62</div><div class="line">63</div><div class="line">64</div><div class="line">65</div><div class="line">66</div><div class="line">67</div><div class="line">68</div><div class="line">69</div><div class="line">70</div><div class="line">71</div><div class="line">72</div><div class="line">73</div><div class="line">74</div><div class="line">75</div><div class="line">76</div><div class="line">77</div><div class="line">78</div><div class="line">79</div><div class="line">80</div><div class="line">81</div><div class="line">82</div><div class="line">83</div><div class="line">84</div><div class="line">85</div><div class="line">86</div><div class="line">87</div><div class="line">88</div><div class="line">89</div><div class="line">90</div><div class="line">91</div><div class="line">92</div><div class="line">93</div><div class="line">94</div><div class="line">95</div><div class="line">96</div><div class="line">97</div><div class="line">98</div><div class="line">99</div><div class="line">100</div><div class="line">101</div><div class="line">102</div><div class="line">103</div><div class="line">104</div><div class="line">105</div></pre></td><td class="code"><pre><div class="line"><span class="meta">#<span class="meta-keyword">include</span> <span class="meta-string">"node.h"</span></span></div><div class="line"><span class="meta">#<span class="meta-keyword">include</span> <span class="meta-string">&lt;stdio.h&gt;</span></span></div><div class="line"><span class="meta">#<span class="meta-keyword">include</span> <span class="meta-string">&lt;stdlib.h&gt;</span></span></div><div class="line"></div><div class="line"><span class="comment">// typedef struct _node&#123;</span></div><div class="line"><span class="comment">// 	int value;</span></div><div class="line"><span class="comment">// 	struct _node *next;</span></div><div class="line"><span class="comment">// &#125;Node;</span></div><div class="line"></div><div class="line"><span class="keyword">typedef</span> <span class="keyword">struct</span> _list&#123; <span class="comment">// 没有为检点的版本</span></div><div class="line">	Node *head;</div><div class="line">	Node *tail;</div><div class="line">&#125; List;</div><div class="line"></div><div class="line"><span class="comment">// typedef struct _list&#123;</span></div><div class="line"><span class="comment">// 	Node *head;</span></div><div class="line"><span class="comment">// 	Node *tail;</span></div><div class="line"><span class="comment">// &#125; List;</span></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"><span class="function"><span class="keyword">void</span> <span class="title">add</span><span class="params">(List *<span class="built_in">list</span>, <span class="keyword">int</span> number)</span></span>;</div><div class="line"><span class="function"><span class="keyword">void</span> <span class="title">add2</span><span class="params">(List *<span class="built_in">list</span>, <span class="keyword">int</span> number)</span></span>;</div><div class="line"><span class="function"><span class="keyword">void</span> <span class="title">print</span><span class="params">(List *<span class="built_in">list</span>)</span></span>;</div><div class="line"><span class="function"><span class="keyword">void</span> <span class="title">queryAndDelete</span><span class="params">(List *<span class="built_in">list</span>, <span class="keyword">int</span> number)</span></span>;</div><div class="line"></div><div class="line"><span class="function"><span class="keyword">int</span> <span class="title">main</span><span class="params">(<span class="keyword">int</span> argc, <span class="keyword">char</span> <span class="keyword">const</span> *argv[])</span></span></div><div class="line">&#123;</div><div class="line">	List <span class="built_in">list</span>;</div><div class="line">	<span class="built_in">list</span>.head = <span class="built_in">list</span>.tail = <span class="literal">NULL</span>;</div><div class="line">	<span class="keyword">int</span> number;</div><div class="line">	<span class="keyword">do</span>&#123;</div><div class="line">		<span class="built_in">scanf</span>(<span class="string">"%d"</span>,&amp;number);</div><div class="line">		<span class="keyword">if</span>(number != <span class="number">-1</span>)&#123;</div><div class="line">			add2(&amp;<span class="built_in">list</span>,number);</div><div class="line">		&#125;</div><div class="line">	&#125;<span class="keyword">while</span>(number != <span class="number">-1</span>);</div><div class="line">	print(&amp;<span class="built_in">list</span>);</div><div class="line">	<span class="built_in">scanf</span>(<span class="string">"%d"</span>,&amp;number);</div><div class="line">	queryAndDelete(&amp;<span class="built_in">list</span>,number);</div><div class="line">	print(&amp;<span class="built_in">list</span>);</div><div class="line">	<span class="keyword">return</span> <span class="number">0</span>;</div><div class="line">&#125;</div><div class="line"></div><div class="line"><span class="function"><span class="keyword">void</span> <span class="title">add</span><span class="params">(List *<span class="built_in">list</span>, <span class="keyword">int</span> number)</span></span>&#123;</div><div class="line">	<span class="comment">// add to linked-list</span></div><div class="line">	Node *p = (Node*)<span class="built_in">malloc</span>(<span class="keyword">sizeof</span>(Node));</div><div class="line">	p-&gt;value = number;</div><div class="line">	p-&gt;next = <span class="literal">NULL</span>;</div><div class="line">	<span class="comment">// find last node</span></div><div class="line">	Node *last = <span class="built_in">list</span>-&gt;head;</div><div class="line">	<span class="keyword">if</span>(last)&#123;</div><div class="line">		<span class="keyword">while</span>(last-&gt;next)&#123;</div><div class="line">			last = last-&gt;next;</div><div class="line">		&#125;</div><div class="line">		last-&gt;next = p;</div><div class="line">	&#125;<span class="keyword">else</span>&#123;</div><div class="line">		<span class="built_in">list</span>-&gt;head = p;</div><div class="line">	&#125;</div><div class="line"></div><div class="line"></div><div class="line">&#125;</div><div class="line"></div><div class="line"><span class="function"><span class="keyword">void</span> <span class="title">add2</span><span class="params">(List *<span class="built_in">list</span>, <span class="keyword">int</span> number)</span></span>&#123;  <span class="comment">// 哎，早画图早解决了服了</span></div><div class="line">	<span class="comment">// add to linked-list</span></div><div class="line">	Node *p = (Node*)<span class="built_in">malloc</span>(<span class="keyword">sizeof</span>(Node));</div><div class="line">	p-&gt;value = number;</div><div class="line">	p-&gt;next = <span class="literal">NULL</span>;</div><div class="line">	<span class="comment">// find last node</span></div><div class="line">	<span class="keyword">if</span>(<span class="built_in">list</span>-&gt;tail)&#123;</div><div class="line">		(<span class="built_in">list</span>-&gt;tail)-&gt;next = p;</div><div class="line">		<span class="built_in">list</span>-&gt;tail = (<span class="built_in">list</span>-&gt;tail)-&gt;next;</div><div class="line"></div><div class="line">	&#125;<span class="keyword">else</span>&#123;</div><div class="line">		<span class="built_in">list</span>-&gt;head = <span class="built_in">list</span>-&gt;tail = p;</div><div class="line"></div><div class="line">	&#125;</div><div class="line"></div><div class="line">&#125;</div><div class="line"></div><div class="line"><span class="function"><span class="keyword">void</span> <span class="title">print</span><span class="params">(List *<span class="built_in">list</span>)</span></span>&#123;</div><div class="line">	<span class="keyword">for</span> (Node *q = <span class="built_in">list</span>-&gt;head;q;q=q-&gt;next)&#123;</div><div class="line">		<span class="built_in">printf</span>(<span class="string">"%d\t"</span>,q-&gt;value);</div><div class="line">	&#125;</div><div class="line">	<span class="built_in">printf</span>(<span class="string">"\n"</span>);</div><div class="line">&#125;</div><div class="line"><span class="function"><span class="keyword">void</span> <span class="title">queryAndDelete</span><span class="params">(List *<span class="built_in">list</span>,<span class="keyword">int</span> number)</span></span>&#123;</div><div class="line">	<span class="keyword">int</span> isFound = <span class="number">0</span>;</div><div class="line">	Node *p = <span class="literal">NULL</span>;</div><div class="line">	<span class="keyword">for</span> ( Node *q = <span class="built_in">list</span>-&gt;head;q;p = q,q=q-&gt;next)&#123;</div><div class="line">		<span class="keyword">if</span>(q-&gt;value == number)&#123;</div><div class="line">			isFound = <span class="number">1</span>;</div><div class="line">			<span class="keyword">if</span>(q)&#123;</div><div class="line">				p-&gt;next = q-&gt;next;</div><div class="line">			&#125;<span class="keyword">else</span>&#123;</div><div class="line">				(<span class="built_in">list</span>-&gt;head)-&gt;next = q-&gt;next;</div><div class="line">			&#125;</div><div class="line">			<span class="built_in">free</span>(q);</div><div class="line">			<span class="keyword">break</span>;</div><div class="line">		&#125;</div><div class="line">	&#125;</div><div class="line">	<span class="keyword">if</span>(isFound)&#123;</div><div class="line">		<span class="built_in">printf</span>(<span class="string">"找到了\n"</span>);</div><div class="line">	&#125;</div><div class="line">&#125;</div></pre></td></tr></table></figure></p>

          
        
      
    </div>

    <div>
      
    </div>

    <div>
      
    </div>


    <footer class="post-footer">
      

      

      

      
      
        <div class="post-eof"></div>
      
    </footer>
  </article>


    
      

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
    <link itemprop="mainEntityOfPage" href="http://yoursite.com/2017/03/20/构造之法第5章/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Jenius">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/jenius.jpeg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="jeniusLi's blog">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                
                <a class="post-title-link" href="/2017/03/20/构造之法第5章/" itemprop="url">
                  构造之法第5章
                </a>
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2017-03-20T12:58:41+08:00">
                2017-03-20
              </time>
            

            

            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    


    <div class="post-body" itemprop="articleBody">

      
      

      
        
          
            <h2 id="第5章团队和流程概述"><a href="#第5章团队和流程概述" class="headerlink" title="第5章团队和流程概述"></a>第5章团队和流程概述</h2><ul>
<li><strong>理论和知识点</strong></li>
<li><strong>典型的软件团队模式和开发流程都有哪些？各有什么优缺点</strong></li>
<li><strong>MVP,MBP,RUP</strong></li>
<li><strong>练习与讨论</strong></li>
<li><strong>团队模式和开发效率的关系</strong><br>讲了什么是非团队，和一些软件团队的模式：<h2 id="主治医师模式"><a href="#主治医师模式" class="headerlink" title="主治医师模式"></a>主治医师模式</h2>选取一个首席程序员，负责处理主要模型的设计和编码，其他人员负责配合和支持他／她。<br>但是这种模式往往会从这一模式退化为“一个学生干活，其余学生跟着打酱油”。<h2 id="明星模式"><a href="#明星模式" class="headerlink" title="明星模式"></a>明星模式</h2>主治医师模式运用到极点，可以蜕化为明星模式，在这里，明星光环盖过了团队其他人的总和，但是这个明星万一哪天陨落了，这个团队是否可以正常运行。<h2 id="社区模式"><a href="#社区模式" class="headerlink" title="社区模式"></a>社区模式</h2>社区由很多志愿者参与，每个人参与自己感兴趣的项目，贡献力量，大部分人不拿报酬，发挥大众的力量但是，同时代码质量也要进行严格的控制。<h2 id="业余剧团模式"><a href="#业余剧团模式" class="headerlink" title="业余剧团模式"></a>业余剧团模式</h2>这样的团队在每一个项目中，不同的人会挑选不同的角色。在下一个项目中这些人也许也会换一个完全不同的角色类型。各人在团队中听从一个中央指挥的指挥和安排。<h2 id="神秘团队"><a href="#神秘团队" class="headerlink" title="神秘团队"></a>神秘团队</h2>一些软件项目在秘密状态下进行，别人不知道他们具体在做什么。这种模式好处是：团队内部有极大的自由，没有外界的干扰，团队成员有极大的投入。<h2 id="特工团队"><a href="#特工团队" class="headerlink" title="特工团队"></a>特工团队</h2>软件行业的一些团队由一些有特殊技能的专业人士组成，负责一些棘手的而有紧迫的问题。例如一些专门做网站安全性服务团队。<h2 id="交响乐团模式"><a href="#交响乐团模式" class="headerlink" title="交响乐团模式"></a>交响乐团模式</h2>特点如下：</li>
<li><strong>工具齐全</strong></li>
<li><strong>各司其职</strong></li>
<li><strong>有统一的指挥</strong></li>
<li><strong>具有多个项目的的开发经验</strong><h2 id="爵士乐模式"><a href="#爵士乐模式" class="headerlink" title="爵士乐模式"></a>爵士乐模式</h2>特点如下：</li>
<li><strong>工作比较随意</strong></li>
<li><strong>主要的程序员没有现场指挥</strong></li>
<li><strong>架构师搭建架构之后，程序员自由发挥</strong></li>
<li><strong>人数较少</strong><br>强调个性化的表达，强有力的互动，对变化的内容有创意的回应。<h2 id="功能团队模式"><a href="#功能团队模式" class="headerlink" title="功能团队模式"></a>功能团队模式</h2>具备不同能力的同事平等协作，共同完成一个功能。他们之间没有管理和被管理的关系。<h2 id="官僚模式"><a href="#官僚模式" class="headerlink" title="官僚模式"></a>官僚模式</h2><img src="/images/guanliao.png" alt="Alt text"><br>层层管理的官僚模式<br>这种模式在软件开发中会出问题。因为成员之间不光有技术方面的合作和领导，同时还混进了组织上的领导和被领导关系。跨组织的合作变得比较困难，因为各自头顶上都有不同的老板。这种模式如果应用不好，最后会变成“老板驱动”的开发流程。<h2 id="开发流程"><a href="#开发流程" class="headerlink" title="开发流程"></a>开发流程</h2>我们在开发、运营、维护软件的过程中有很多技术、做法、习惯和思想。软件工程把这些相关的技术和过程统一到一个体系中，叫“软件开发流程”，软件开发流程的目的是为了提高软件开发、运营和维护的效率，以及提升用户满意度、软件的可靠性和可维护性。<h2 id="写了在改模式"><a href="#写了在改模式" class="headerlink" title="写了在改模式"></a>写了在改模式</h2><img src="/images/xieafterupdate.png" alt="Alt text"><br>这个流程也有好处，不需要太多其他准备或相关知识，大家上来就写代码，也许就能写出来，写不出来就改，也许能改好。当面临下面的任务时，也许这个方法是有用的。 “只用一次”的程序 “看过了就扔”的原型 一些不实用的演示程序 但是，要写一个有实际用户、解决实际需求的软件，这个方法的缺点就太但是，要写一个有实际用户、解决实际需求的软件，这个方法的缺点就太大了。要注意的是，许多学校里的软件工程作业的要求符合上面那三点，所以难怪同学们觉得没有必要用其他的开发方法，“写了再改”足矣！<h2 id="瀑布模型"><a href="#瀑布模型" class="headerlink" title="瀑布模型"></a>瀑布模型</h2>当软件行业还在年幼的时期，它从别的成熟行业（硬件设计，建筑工程）借用了不少经验和模型。在那些“硬”的行业中，产品大多遵循 [分析→设计→实现（制造）→销售→维护] 这个流程。由于在“硬”行业中产品一旦大规模生产，要再返回去修改时就非常困难，甚至是不可能的。因此这个模型描述了单向的<br><img src="/images/waterfall.png" alt="Alt text"><br>温斯顿正确地指出了在设计大型系统时，要做相邻步骤的回溯，解决上一阶段未能解决的问题:又如, 温斯顿指出,要让产品成功,最好把这个模型走两遍,先有一个模拟版本(Simulation of FinalProduct),在此基础上收集反馈,改进各个步骤,并交付一个最终的版本:<br><img src="/images/shouji.png" alt="Alt text"></li>
</ul>

          
        
      
    </div>

    <div>
      
    </div>

    <div>
      
    </div>


    <footer class="post-footer">
      

      

      

      
      
        <div class="post-eof"></div>
      
    </footer>
  </article>


    
      

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
    <link itemprop="mainEntityOfPage" href="http://yoursite.com/2017/03/20/构造之法第2章/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Jenius">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/jenius.jpeg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="jeniusLi's blog">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                
                <a class="post-title-link" href="/2017/03/20/构造之法第2章/" itemprop="url">
                  构造之法第2章
                </a>
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2017-03-20T12:02:21+08:00">
                2017-03-20
              </time>
            

            

            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    


    <div class="post-body" itemprop="articleBody">

      
      

      
        
          
            <h2 id="第2章概论"><a href="#第2章概论" class="headerlink" title="第2章概论"></a>第2章概论</h2><p>这一章是讲自身技术的，首先讲到了单元测试，书中说：最好是在设计的时候就写好评单元测试，这样单元测试就能体现API的语义。还提到效能分析工具，从时间复杂度和空间复杂度来判定效能。提到了个人的开发流程，从在校大学生和硕士毕业后工作三年后的个人工作流程进行对比发现后者花在编码阶段的时间大大减少和花在需求分析和软件测试阶段的时间增加了，并且这两者占到了整个开发流程的60%。最后是实践还有更加详细的讲到了回归测试，回归简单的来说就是已经做好的模块，并且单元测试做的也没有问题，结果引入新的模块后出现了老得的模块的问题叫做回归。</p>
<h2 id="总结"><a href="#总结" class="headerlink" title="总结"></a>总结</h2><p>我作为在校大三的学生，也是会遇到过类似的问题。老师让做一个课程设计，用java写一个ATM，我当时觉得自己java学的不错（在我们班而言）就迫不及待的就直接编码了。当时什么架构也都不知道，也没有学软件工程，也不清楚个人的开发流程是什么，直接上来就编码。作了可能有一半了发现发现自己写的程序不符合面向对象的要求，也不符合MVC架构的准则。就重新写了一遍，写完之后发现，代码清清爽爽。这也算自己或者大多数，学编程初期的人都会遇到的一个问题吧。现在如果说做一个软件，我估计会强忍着，一上来就去写代码的冲动好好的把需求分析一下，数据库设计一下，功能梳理一下。说实话，第2章是关于测试的，本身来说对测试兴趣不是很高，所以，只是粗略的看了一下，但并不是测试不重要，只是个人感觉兴趣不大。</p>

          
        
      
    </div>

    <div>
      
    </div>

    <div>
      
    </div>


    <footer class="post-footer">
      

      

      

      
      
        <div class="post-eof"></div>
      
    </footer>
  </article>


    
      

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
    <link itemprop="mainEntityOfPage" href="http://yoursite.com/2017/03/19/读构建之法体会/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Jenius">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/jenius.jpeg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="jeniusLi's blog">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                
                <a class="post-title-link" href="/2017/03/19/读构建之法体会/" itemprop="url">
                  读构建之法体会
                </a>
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2017-03-19T16:22:18+08:00">
                2017-03-19
              </time>
            

            

            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    


    <div class="post-body" itemprop="articleBody">

      
      

      
        
          
            <h2 id="构建之法简介"><a href="#构建之法简介" class="headerlink" title="构建之法简介"></a>构建之法简介</h2><p>  软件工程牵涉的范围很广, 同时也是一般院校的同学反映比较空洞乏味的课程。 但是 软件工程的技术对于投身IT 产业的学生来说是非常重要的。作者邹欣有长达20年的一线软件开发经验，他利用业余时间在数所高校进行了长达6年的软件工程教学实践，总结出了在16周的时间内让 同学们通过 “做中学 (Learning By Doing)” 掌握实用的软件工程技术的教学计划，并得到高校师生的积极反馈。在此基础上，作者对软件工程的各个知识点和技能要求进行了系统性整理，形成教材。<br>  我将逐章的概述内容及我读完之后的感受</p>
<h2 id="第1章概论"><a href="#第1章概论" class="headerlink" title="第1章概论"></a>第1章概论</h2><p>首先一上来提到了一个公式：软件=程序+软件工程<br>之后提出了三个问题或者叫做三个现象吧。之后讲了一个例子：从一个出30道加减法的题扩展到一个具有各种功能而且庞大的web应用。在这个例子中就会设计一些算法和数据结构，我想应该没有人会写这样的库给开发者用，所以需要自己去写一些算法和数据结构。后面引出了，程序的运行环境、源代码管理、软件的质量保证的过程是软件测试、绣球分析、软件维护、软件的生命周期和用户体验等概念。上述皆为软件开发活动行管的内容。<br>之后提到了软件团队赚钱的方式。再从广义上的软件工程也包括用户体验、用户界面等。从而推出一个公式：软件＝程序＋软件工程。又从中扩展到软件企业＝软件＋商业模式。<br>用折纸飞机的玩具阶段、用氢气球飞上天的业余爱好阶段、莱特兄弟制造飞机的探索阶段、现在的航空业的成熟的产业阶段类比软件开发的不同阶段：<br><img src="/images/soft classify.png" alt="Alt text"><br>软件工程是把系统的、有序的、可量化的放大应用到软件的开发、运营和维护上的过程。介绍了软件工程包含了哪些领域以及与软件工程相关的一些领域。简单介绍了一下软件开发流程和一些工具。<br>软件的特殊性共总结了五点内容：</p>
<ul>
<li><strong>复杂性</strong></li>
<li><strong>不可见性</strong></li>
<li><strong>易变性</strong></li>
<li><strong>服从性</strong></li>
<li><strong>非连续性</strong><br>之后对软件工程和计算机科学之间的关系、侧重点和领域等做出比较。<br>最后谈了谈bug的来历。</li>
</ul>
<h2 id="总结"><a href="#总结" class="headerlink" title="总结"></a>总结</h2><p>在我看来就是造轮子和用轮子，作为java程序员想快速做出一个网站，不算是难事，即便用上SSM(Spring MVC,Spring,Mybatis)再加上基于RESTFul API的Swagger实现前后端分离的契约。还是加上缓存redis等技术对于数据结构和算法运用的不是很多基本上都是围绕着对数据库的增、删、改、查，这几个操作。肯定会有这个阶段，我们只需要会用轮子，还需要关注轮子是怎么造的嘛？在我看来数据结构和算法是一个编程员的基本功。所以基本功往往不是一时半会可以出效果的，如果不在乎这些基本功，也许一年两年在工作中不会体现，不过在这个领域呆的时间越久我确信，没有这些基本功作为保证，以后会遇见各种各样的瓶颈。</p>

          
        
      
    </div>

    <div>
      
    </div>

    <div>
      
    </div>


    <footer class="post-footer">
      

      

      

      
      
        <div class="post-eof"></div>
      
    </footer>
  </article>


    
      

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
    <link itemprop="mainEntityOfPage" href="http://yoursite.com/2017/03/19/文章测试/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Jenius">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/jenius.jpeg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="jeniusLi's blog">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                
                <a class="post-title-link" href="/2017/03/19/文章测试/" itemprop="url">
                  Markdown简介
                </a>
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2017-03-19T14:14:37+08:00">
                2017-03-19
              </time>
            

            

            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    


    <div class="post-body" itemprop="articleBody">

      
      

      
        
          
            <h2 id="Markdown简介"><a href="#Markdown简介" class="headerlink" title="Markdown简介"></a>Markdown简介</h2><blockquote>
<p>Markdown 是一种轻量级标记语言，它允许人们使用易读易写的纯文本格式编写文档，然后转换成格式丰富的HTML页面。    —— <a href="https://zh.wikipedia.org/wiki/Markdown" target="_blank" rel="external">维基百科</a></p>
</blockquote>
<p>正如您在阅读的这份文档，它使用简单的符号标识不同的标题，将某些文字标记为<strong>粗体</strong>或者<em>斜体</em>，创建一个<a href="http://www.example.com" target="_blank" rel="external">链接</a>或一个脚注[^demo]。下面列举了几个高级功能，更多语法请按<code>Cmd + /</code>查看帮助。</p>

          
        
      
    </div>

    <div>
      
    </div>

    <div>
      
    </div>


    <footer class="post-footer">
      

      

      

      
      
        <div class="post-eof"></div>
      
    </footer>
  </article>


    
      

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
    <link itemprop="mainEntityOfPage" href="http://yoursite.com/2017/03/17/hello-world/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Jenius">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/jenius.jpeg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="jeniusLi's blog">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                
                <a class="post-title-link" href="/2017/03/17/hello-world/" itemprop="url">
                  Hello World
                </a>
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2017-03-17T21:18:15+08:00">
                2017-03-17
              </time>
            

            

            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    


    <div class="post-body" itemprop="articleBody">

      
      

      
        
          
            <p>Welcome to <a href="https://hexo.io/" target="_blank" rel="external">Hexo</a>! This is your very first post. Check <a href="https://hexo.io/docs/" target="_blank" rel="external">documentation</a> for more info. If you get any problems when using Hexo, you can find the answer in <a href="https://hexo.io/docs/troubleshooting.html" target="_blank" rel="external">troubleshooting</a> or you can ask me on <a href="https://github.com/hexojs/hexo/issues" target="_blank" rel="external">GitHub</a>.</p>
<h2 id="Quick-Start"><a href="#Quick-Start" class="headerlink" title="Quick Start"></a>Quick Start</h2><h3 id="Create-a-new-post"><a href="#Create-a-new-post" class="headerlink" title="Create a new post"></a>Create a new post</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">$ hexo new <span class="string">"My New Post"</span></div></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/writing.html" target="_blank" rel="external">Writing</a></p>
<h3 id="Run-server"><a href="#Run-server" class="headerlink" title="Run server"></a>Run server</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">$ hexo server</div></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/server.html" target="_blank" rel="external">Server</a></p>
<h3 id="Generate-static-files"><a href="#Generate-static-files" class="headerlink" title="Generate static files"></a>Generate static files</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">$ hexo generate</div></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/generating.html" target="_blank" rel="external">Generating</a></p>
<h3 id="Deploy-to-remote-sites"><a href="#Deploy-to-remote-sites" class="headerlink" title="Deploy to remote sites"></a>Deploy to remote sites</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">$ hexo deploy</div></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/deployment.html" target="_blank" rel="external">Deployment</a></p>

          
        
      
    </div>

    <div>
      
    </div>

    <div>
      
    </div>


    <footer class="post-footer">
      

      

      

      
      
        <div class="post-eof"></div>
      
    </footer>
  </article>


    
  </section>

  

          
          </div>
          


          

        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      

      <section class="site-overview sidebar-panel sidebar-panel-active">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="/images/jenius.jpeg"
               alt="Jenius" />
          <p class="site-author-name" itemprop="name">Jenius</p>
           
              <p class="site-description motion-element" itemprop="description">主要是学习后端技术，学过Java web、python web等后台技术</p>
          
        </div>
        <nav class="site-state motion-element">
        
          
            <div class="site-state-item site-state-posts">
              <a href="/archives">
                <span class="site-state-item-count">6</span>
                <span class="site-state-item-name">日志</span>
              </a>
            </div>
          

          

          

        </nav>

        

        <div class="links-of-author motion-element">
          
        </div>

        
        

        
        

        


      </section>

      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy; 
  <span itemprop="copyrightYear">2017</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Jenius</span>
</div>


<div class="powered-by">
  由 <a class="theme-link" href="https://hexo.io">Hexo</a> 强力驱动
</div>

<div class="theme-info">
  主题 -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Muse
  </a>
</div>


        

        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    
    
  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  




  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.0"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.0"></script>



  
  

  

  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.0"></script>



  



  




	





  





  





  



  
  

  

  

  

  


  

</body>
</html>
